package com.common;



import com.hibernate.Userinfo;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class AuthorityInterceptor extends MethodFilterInterceptor {

	private static final long serialVersionUID = -6797490306353405528L;

	@Override
	protected String doIntercept(ActionInvocation actionInvocation) throws Exception {
		Userinfo user=(Userinfo) ActionContext.getContext().getSession().get("userinfo");
		
		String url = actionInvocation.getProxy().getActionName();
		//System.out.println(url);
		if(user!=null||url.equals("Login_system")){
			return actionInvocation.invoke();
		}else{
			return Action.LOGIN;
		}
	}
}